package com.applcn.shop.controller.feign;

import com.applcn.core.base.Result;
import com.applcn.shop.service.ShopService;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * com.applcn.order.controller.feign
 * Description:
 *
 * @author: 大妖怪
 * @date: 2020-02-22 15:14
 */
@RestController
@RequestMapping("/feign/shop")
@RequiredArgsConstructor
public class ShopFeign {

    private final ShopService shopService;

    /**
     * 通过id列表查询店铺
     *
     * @param ids
     * @return
     */
    @GetMapping("/listShopByIds")
    public Result listShopByIds(@RequestParam("ids") List<Long> ids) {
        return shopService.listShopByIds(ids);
    }

    /**
     * 查询店铺绑定商户
     *
     * @param shopId
     * @return
     */
    @GetMapping("/listMerchantByShopId")
    public Result listMerchantByShopId(@RequestParam("shopId") Long shopId) {
        return shopService.listMerchantByShopId(shopId);
    }

    /**
     * 店铺绑定商户
     *
     * @param shopId
     * @param merchantIds
     * @return
     */
    @PostMapping("/bindMerchants")
    public Result bindMerchants(@RequestParam("shopId") Long shopId, @RequestParam("merchantIds") List<Long> merchantIds) {
        return shopService.bindMerchants(shopId, merchantIds);
    }
}
